﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AlgorithmExercise.Introduction
{
    //线性查找
    public class LinearSearch
    {
        public LinearSearch()
        {
            var random = new Random();
            int[] array = new int[100];
            for (int n = 0; n < array.Length; n++)
            {
                array[n] = random.Next(1000);
            }
            int u = random.Next(1000);
            int result = -1;
            for (int i = 0; i < array.Length; i++)
            {
                if (u == array[i])
                {
                    Console.WriteLine(i);
                    result = i;
                }
            }
            if (result == -1)
            {
                u = -1;
                Console.WriteLine("u=null");
            }
        }
    }
}
